from csagent.core.node.base_node import BaseNode
from csagent.core.context import AgentState
import copy
import time
class Node(BaseNode):
    def initialize(self):
        """初始化节点"""
        print(self.conf)
        print(f"{self.node_config.name} Node初始化成功")
    def execute(self, state: AgentState, stream_writer) -> AgentState:
        print(f"{self.node_config.name} node开始执行")
        parallel_info = state['parallel_info']
        print(f"parallel_info:{parallel_info}")
        print("文档解读结果聚合中")
        time.sleep(1)
        state['extra']['doc_analysis_res'] = []
        for id, item in parallel_info.items():
            state['extra']['doc_analysis_res'].append(item)
        return state